package com.ybkj.o2o.sales.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 活动.
 * 
 * @author Shine
 * 
 */
public class Activity extends Base {
  /**
   * 版本号.
   */
  private static final long serialVersionUID = 1L;

  public static final int ACTIVITY_STATUS_NOTSTART = 0;
  public static final int ACTIVITY_STATUS_ONUSING = 1;
  public static final int ACTIVITY_STATUS_OVERDUE = 2;

  public static final int ACTIVITY_FREETYPE_FREEALL = 0;
  public static final int ACTIVITY_FREETYPE_FREEPART = 1;
  public static final int ACTIVITY_FREETYPE_FREEOTHER = 2;

  private ActivityType activityType;// 活动类型

  private ActivityTarget activityTarget;// 活动对象

  private ActivityEvent activityEvent;// 活动事件

  private String companyIds;

  private String companyNames;

  private String gradeIds;// 客户等级id ,1,12,65,

  private String gradeNames;// 客户等级名称 vip,黄金,xx

  private Integer completeTimes;// 每完成completeTimes次代驾 奖励

  private Integer restriction;// 限制领取次数

  private Integer shareTimes;// 满足的分享次数

  private String activityContent;// 活动规则

  private String passengerFromSource;// 客户来源

  private String orderFromSource;// 订单来源

  private OrderType orderType;// 订单类型 代驾 专车

  private BigDecimal money;// 返现金额

  private String couponIds;// 优惠券id，临时

  private String couponAmounts;// 优惠券数量，临时

  private List<ActivityCouponRule> activityCouponRules;// 活动选择的优惠券

  private Long companyId;

  private boolean stoped;// 是否停止

  private Date start;// 开始时间

  private Date end;// 结束时间

  private String messageType;// 通知方式

  private String activityImage;// 活动图片

  private String backgroudColor;// 背景颜色

  private String sharePlatforms;

  private String sharePlatformNames;

  private Integer freeType;// 0全部免费 1按照百分比免除金额 2自定义

  private BigDecimal otherMoney;// 自定义价格

  private Double percentPrice;// 百分比价格

  private BigDecimal rechargingMoney;// 充值送券、送现金

  private String appKey;

  private Long lineId;

  private String lineName;

  public String getLineName() {
    return lineName;
  }

  public void setLineName(String lineName) {
    this.lineName = lineName;
  }

  public Long getLineId() {
    return lineId;
  }

  public void setLineId(Long lineId) {
    this.lineId = lineId;
  }

  public BigDecimal getRechargingMoney() {
    return rechargingMoney;
  }

  public void setRechargingMoney(BigDecimal rechargingMoney) {
    this.rechargingMoney = rechargingMoney;
  }

  public Double getPercentPrice() {
    return percentPrice;
  }

  public void setPercentPrice(Double percentPrice) {
    this.percentPrice = percentPrice;
  }

  public Integer getFreeType() {
    return freeType;
  }

  public void setFreeType(Integer freeType) {
    this.freeType = freeType;
  }

  public BigDecimal getOtherMoney() {
    return otherMoney;
  }

  public void setOtherMoney(BigDecimal otherMoney) {
    this.otherMoney = otherMoney;
  }

  public String getBackgroudColor() {
    return backgroudColor;
  }

  public void setBackgroudColor(String backgroudColor) {
    this.backgroudColor = backgroudColor;
  }

  public String getActivityImage() {
    return activityImage;
  }

  public void setActivityImage(String activityImage) {
    this.activityImage = activityImage;
  }

  public String getActivityContent() {
    return activityContent;
  }

  public void setActivityContent(String activityContent) {
    this.activityContent = activityContent;
  }

  public Integer getRestriction() {
    return restriction;
  }

  public void setRestriction(Integer restriction) {
    this.restriction = restriction;
  }

  public BigDecimal getMoney() {
    return money;
  }

  public void setMoney(BigDecimal money) {
    this.money = money;
  }

  public ActivityType getActivityType() {
    return activityType;
  }

  public void setActivityType(ActivityType activityType) {
    this.activityType = activityType;
  }

  public ActivityTarget getActivityTarget() {
    return activityTarget;
  }

  public void setActivityTarget(ActivityTarget activityTarget) {
    this.activityTarget = activityTarget;
  }

  public Long getCompanyId() {
    return companyId;
  }

  public void setCompanyId(Long companyId) {
    this.companyId = companyId;
  }

  public boolean isStoped() {
    return stoped;
  }

  public void setStoped(boolean stoped) {
    this.stoped = stoped;
  }

  public Integer getCompleteTimes() {
    return completeTimes;
  }

  public void setCompleteTimes(Integer completeTimes) {
    this.completeTimes = completeTimes;
  }

  public Date getStart() {
    return start;
  }

  public void setStart(Date start) {
    this.start = start;
  }

  public Date getEnd() {
    return end;
  }

  public void setEnd(Date end) {
    this.end = end;
  }

  public String getGradeIds() {
    return gradeIds;
  }

  public void setGradeIds(String gradeIds) {
    this.gradeIds = gradeIds;
  }

  public String getCouponIds() {
    return couponIds;
  }

  public void setCouponIds(String couponIds) {
    this.couponIds = couponIds;
  }

  public String getCouponAmounts() {
    return couponAmounts;
  }

  public void setCouponAmounts(String couponAmounts) {
    this.couponAmounts = couponAmounts;
  }

  /**
   * 根据现在时间判断活动状态.
   * @return Integer
   */
  public Integer getTimeStatus() {
    if (start.getTime() > new Date().getTime()) {
      return ACTIVITY_STATUS_NOTSTART;
    } else if (null != end && end.getTime() < new Date().getTime()) {
      return ACTIVITY_STATUS_OVERDUE;
    } else {
      return ACTIVITY_STATUS_ONUSING;
    }
  }

  /**
   * 根据现在时间判断活动状态.
   * @return Integer
   */
  public Integer getSort() {
    if (stoped) {
      return 2;
    }
    if (start.getTime() > new Date().getTime()) {
      return 1;
    } else if (null != end && end.getTime() < new Date().getTime()) {
      return 2;
    } else {
      return 0;
    }
  }

  public Integer getShareTimes() {
    return shareTimes;
  }

  public void setShareTimes(Integer shareTimes) {
    this.shareTimes = shareTimes;
  }

  public String getGradeNames() {
    return gradeNames;
  }

  public void setGradeNames(String gradeNames) {
    this.gradeNames = gradeNames;
  }

  public OrderType getOrderType() {
    return orderType;
  }

  public void setOrderType(OrderType orderType) {
    this.orderType = orderType;
  }

  public List<ActivityCouponRule> getActivityCouponRules() {
    return activityCouponRules;
  }

  public void setActivityCouponRules(List<ActivityCouponRule> activityCouponRules) {
    this.activityCouponRules = activityCouponRules;
  }

  public ActivityEvent getActivityEvent() {
    return activityEvent;
  }

  public void setActivityEvent(ActivityEvent activityEvent) {
    this.activityEvent = activityEvent;
  }

  public String getAppKey() {
    return appKey;
  }

  public void setAppKey(String appKey) {
    this.appKey = appKey;
  }

  public String getCompanyIds() {
    return companyIds;
  }

  public void setCompanyIds(String companyIds) {
    this.companyIds = companyIds;
  }

  public String getCompanyNames() {
    return companyNames;
  }

  public void setCompanyNames(String companyNames) {
    this.companyNames = companyNames;
  }

  public String getPassengerFromSource() {
    return passengerFromSource;
  }

  public void setPassengerFromSource(String passengerFromSource) {
    this.passengerFromSource = passengerFromSource;
  }

  public String getOrderFromSource() {
    return orderFromSource;
  }

  public void setOrderFromSource(String orderFromSource) {
    this.orderFromSource = orderFromSource;
  }

  public String getMessageType() {
    return messageType;
  }

  public void setMessageType(String messageType) {
    this.messageType = messageType;
  }

  public String getSharePlatforms() {
    return sharePlatforms;
  }

  public void setSharePlatforms(String sharePlatforms) {
    this.sharePlatforms = sharePlatforms;
  }

  public String getSharePlatformNames() {
    return sharePlatformNames;
  }

  public void setSharePlatformNames(String sharePlatformNames) {
    this.sharePlatformNames = sharePlatformNames;
  }

  /**
   * 返回活动事件字符.
   * @return String
   */
  public String getActivityEventName() {
    if (null != activityEvent) {
      if (activityEvent.equals(ActivityEvent.newRegister)) {
        return "新客户注册";
      } else if (activityEvent.equals(ActivityEvent.adminGift)) {
        return "手动赠送优惠券";
      } else if (activityEvent.equals(ActivityEvent.phoneGift)) {
        return "输入手机号赠送优惠券或金额";
      } else if (activityEvent.equals(ActivityEvent.shareSuccess)) {
        return "分享成功";
      } else if (activityEvent.equals(ActivityEvent.orderCompleteTimes)) {
        return "完成订单";
      } else if (activityEvent.equals(ActivityEvent.invite)) {
        return "邀请客户";
      } else if (activityEvent.equals(ActivityEvent.firstOrderFree)) {
        return "首单免费";
      } else if (activityEvent.equals(ActivityEvent.recharging)) {
        return "充值送礼";
      } else if (activityEvent.equals(ActivityEvent.lineCoupon)){
        return "线路优惠";
      } else {
        return null;
      }
    } else {
      return null;
    }
  }



  public enum OrderType {
    /**
     * 代驾.
     */
    daijia,
    /**
     * 专车.
     */
    zhuanche,
    /**
     * 货运.
     */
    freight,
    /**
     * 跑腿.
     */
    errand,
    /**
     * 专线.
     */
    zhuanxian

  }

  public enum ActivityType {
    /**
     * 返现.
     */
    cash,
    /**
     * 反劵.
     */
    coupon

  }

  public enum PassengerFromSource {

    电话预约, 司机补单, APP预约, 微信预约, 客户经理, 网站预约,

  }

  public enum OrderFromSource {

    电话预约, 司机补单, APP预约, 微信预约, 客户经理, 网站预约

  }

  public enum ActivityEvent {
    /**
     * 新注册.
     */
    newRegister,
    /**
     * 手动赠送优惠券.
     */
    adminGift,
    /**
     * 输入手机号赠送优惠券或金额.
     */
    phoneGift,
    /**
     * 分享成功.
     */
    shareSuccess,
    /**
     * 完成代驾满n次.
     */
    orderCompleteTimes,
    /**
     * 邀请.
     */
    invite,
    /**
     * 充值满m元.
     */
    recharging,
    /**
     * 首单免费.
     */
    firstOrderFree,
    /**
     * 线路赠送优惠券
     */
    lineCoupon

  }

  public enum ActivityTarget {
    /**
     * 全部会员.
     */
    all,
    /**
     * 个人会员.
     */
    passenger,
    /**
     * 企业会员.
     */
    enterprise
  }


}
